<template>
    <div>
        <div class="operarea">
            <div class="seach">
                <el-input v-model="seachForm.styleName" placeholder="风格" clearable size="mini" @keyup.enter.native="seachData"></el-input>
                <el-input v-model="seachForm.title" placeholder="标题" clearable size="mini" @keyup.enter.native="seachData"></el-input>
                <el-select v-model="seachForm.publishStatus" placeholder="上下架状态" size="mini" clearable @keyup.enter.native="seachData">
                    <el-option label="上架" :value="2"></el-option>
                    <el-option label="下架" :value="1"></el-option>
                </el-select>
                <el-select v-model="seachForm.newStatus" placeholder="新品状态" size="mini" clearable @keyup.enter.native="seachData">
                    <el-option label="非新品" :value="0"></el-option>
                    <el-option label="新品" :value="1"></el-option>
                </el-select>
                <el-button size="mini" icon="el-icon-search" @click="seachData"></el-button>
            </div>
            <div class="btnList">
                <el-button size="mini" @click="showAddDlog">{{$t('add')}}</el-button>
                <el-button size="mini" @click="showExport">{{$t('export')}}</el-button>
                <el-button size="mini" @click="showPutOrPullData(2)">{{$t('putonsale')}}</el-button>
                <el-button size="mini" @click="showPutOrPullData(1)">{{$t('pulloffshelves')}}</el-button>
                <el-button size="mini" @click="showHandleNew">切换新品状态</el-button>
                <el-button size="mini" @click="showHandleHot">切换热卖状态</el-button>
                <el-button size="mini" @click="showDelData">{{$t('delete')}}</el-button>
            </div>
        </div>
        <el-card class="cardBox">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>款式</el-breadcrumb-item>
                <el-breadcrumb-item>大袍</el-breadcrumb-item>
            </el-breadcrumb>
            <el-table style="width: 100%" ref="robeTable" :data="bigRobeTab" stripe v-adaptive="{bottomOffset: 85}" height="100" row-key="id" @selection-change="handleSelectionChange" @select-all="handleSelectionChange">
                <el-table-column type="selection" :reserve-selection="true">
                </el-table-column>
                <el-table-column prop="itemCode" min-width="131" :label="$t('stylenum')">
                </el-table-column>
                <el-table-column prop="title" min-width="131" :label="$t('title')">
                </el-table-column>
                <el-table-column prop="styleName" min-width="131" :label="$t('style')">
                </el-table-column>
                <el-table-column prop="year" min-width="131" :label="$t('yearofthelisted')">
                </el-table-column>
                <el-table-column prop="technology" min-width="131" :label="$t('designprocess')">
                </el-table-column>
                <el-table-column prop="publishStatus" min-width="131" label="上下架状态">
                    <template v-slot="scope">
                        <el-tag :type="scope.row.publishStatus === '上架' ? 'success' : 'danger'" :effect="scope.row.publishStatus === '上架' ? 'dark' : 'plain'" size="mini">
                            {{ scope.row.publishStatus }}
                        </el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="newStatus" min-width="131" :label="$t('newpro')">
                    <template v-slot="scope">
                        <el-tag :type="scope.row.newStatus === '新品' ? 'success' : 'danger'" :effect="scope.row.newStatus === '新品' ? 'dark' : 'plain'" size="mini">
                            {{ scope.row.newStatus }}
                        </el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="hotStatus" min-width="131" label="热卖">
                    <template v-slot="scope">
                        <el-tag :type="scope.row.hotStatus === '热卖' ? 'success' : 'danger'" :effect="scope.row.hotStatus === '热卖' ? 'dark' : 'plain'" size="mini">
                            {{ scope.row.hotStatus }}
                        </el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="price" min-width="131" :label="$t('price')">
                </el-table-column>
                <el-table-column prop="createTime" min-width="131" :label="$t('addtime')">
                </el-table-column>
                <el-table-column prop="address" min-width="131" :label="$t('operation')" fixed="right">
                    <template v-slot="scope">
                        <el-button @click.stop="getRecommend(scope.row.id)" size="mini">{{$t('redact')}}</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
                small
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :pager-count="11"
                :current-page.sync="seachForm.pageNo"
                :page-sizes="[10, 20, 30, 40]"
                :page-size="seachForm.pageSize"
                layout="sizes, prev, pager, next"
                :total="total">
            </el-pagination>
        </el-card>
        <!-- 添加 -->
        <el-dialog :title="$t('add')" :visible.sync="addRobeItemDialogVisible" width="600px" class="addNFRobeDlog" :close-on-click-modal="false" @close="addDlogClose(addDataForm)">
            <el-form :model="addDataForm" :ref="addDataForm" :rules="addDataRules" label-position="left" label-width="80px">
                <el-form-item label="款号" prop="itemCode">
                    <el-input v-model="addDataForm.itemCode" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="标题" prop="title">
                    <el-input v-model="addDataForm.title" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="上市年份" prop="year">
                    <el-date-picker v-model="addDataForm.year" type="year" format="yyyy" value-format="yyyy" placeholder="请选择"></el-date-picker>
                </el-form-item>
                <el-form-item label="款式工艺" prop="technology">
                    <el-input v-model="addDataForm.technology" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="关键字">
                    <el-input v-model="addDataForm.keywords" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="风格" prop="styleName">
                    <el-input class="styleInput" v-model="addDataForm.styleName" :disabled="true" />
                    <el-button class="styleBtn" size="mini" @click="checkStyle">选择</el-button>
                </el-form-item>
                <el-form-item label="场景" prop="sceneName">
                    <el-input class="styleInput" v-model="addDataForm.sceneName" :disabled="true" />
                    <el-button class="styleBtn" size="mini" @click="checkScene">选择</el-button>
                </el-form-item>
                <el-form-item label="推荐商品" prop="bindIds">
                    <el-select v-model="proRecommendIdList" multiple :disabled="true">
                        <el-option v-for="item in proRecommendList" :key="item.id" :label="item.title" :value="item.id"></el-option>
                    </el-select>
                    <el-button class="styleBtn" size="mini" @click="showRobeStyleListDlog">选择</el-button>
                </el-form-item>
                <el-form-item label="成品编码" prop="bomCode">
                    <el-select v-model="proRobeIdList" multiple :disabled="true">
                        <el-option v-for="item in proRobeList" :key="item.bomCode" :label="item.bomCode" :value="item.bomCode"></el-option>
                    </el-select>
                    <el-button class="styleBtn" size="mini" @click="showMatListDlog">选择</el-button>
                </el-form-item>
                <el-form-item label="主图" prop="indexImg">
                    <el-upload class="upload-demo" action="/sys/image/uploadImage" :on-success="handleIndexImgUrl" :on-remove="hadleIndexRemove" :file-list="fileIndexList" list-type="picture" :limit="1" :on-exceed="scotlandOne" ref="sunsetstripk">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="详情图" prop="defaultImg">
                    <el-upload class="upload-demo" multiple action="/sys/image/uploadImage" :on-success="handleDefaultImgUrl" :on-remove="hadleDefaultRemove" :limit="3" :file-list="fileDefaultList" list-type="picture" :on-exceed="scotlandThr" ref="sunsetstripz">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="轮播图" prop="carouseImg">
                    <el-upload class="upload-demo" multiple action="/sys/image/uploadImage" :on-success="handleCarouselImgUrl" :on-remove="hadleCarouselRemove" :limit="5" :on-exceed="scotlandFif" :file-list="fileCarouselList" list-type="picture" ref="sunsetstripl">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="addRobeItemDialogVisible = false">返回</el-button>
                <el-button type="primary" @click="addData()">保存</el-button>
            </span>
        </el-dialog>
        <!-- 编辑 -->
        <el-dialog title="编辑" :visible.sync="editRobeItemDialogVisible" width="600px" class="addRobeDlog" :close-on-click-modal="false" @close="editDlogClose(editDataForm)">
            <el-form :model="editDataForm" :ref="editDataForm" :rules="editDataFormRules" label-position="left" label-width="80px">
                <el-form-item label="款号" prop="itemCode">
                    <el-input v-model="editDataForm.itemCode" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="标题" prop="title">
                    <el-input v-model="editDataForm.title" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="上市年份" prop="year">
                    <el-date-picker v-model="editDataForm.year" type="year" format="yyyy" value-format="yyyy" placeholder="请选择"></el-date-picker>
                </el-form-item>
                <el-form-item label="款式工艺" prop="technology">
                    <el-input v-model="editDataForm.technology" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="关键字">
                    <el-input v-model="editDataForm.keywords" placeholder="请输入" />
                </el-form-item>
                <el-form-item label="风格" prop="styleName">
                    <el-input class="styleInput" v-model="editDataForm.styleName" readonly />
                    <el-button class="styleBtn" size="mini" @click="checkStyle">选择</el-button>
                </el-form-item>
                <el-form-item label="场景" prop="sceneName">
                    <el-input class="styleInput" v-model="editDataForm.sceneName" :disabled="true" />
                    <el-button class="styleBtn" size="mini" @click="checkScene">选择</el-button>
                </el-form-item>
                <el-form-item label="推荐商品" prop="bindIds">
                    <el-select v-model="proRecommendIdList" multiple :disabled="true">
                        <el-option v-for="item in proRecommendList" :key="item.id" :label="item.title" :value="item.id"></el-option>
                    </el-select>
                    <el-button class="styleBtn" size="mini" @click="showRobeStyleListDlog">选择</el-button>
                </el-form-item>
                <!-- <el-form-item label="成品编码">
                    <el-select v-model="proRobeIdList" multiple :disabled="true">
                        <el-option v-for="item in proRobeList" :key="item.bomCode" :label="item.bomCode" :value="item.bomCode"></el-option>
                    </el-select>
                    <el-button class="styleBtn" size="mini" @click="showMatListDlog">选择</el-button>
                </el-form-item> -->
                <el-form-item label="主图" prop="indexImg">
                    <el-upload class="upload-demo" action="/sys/image/uploadImage" :on-success="handleIndexImgUrl" :limit="1" :on-remove="hadleIndexRemove" :on-exceed="scotlandOne" :file-list="fileIndexList" list-type="picture" ref="sunsetstripk">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="详情图" prop="defaultImg">
                    <el-upload class="upload-demo" multiple action="/sys/image/uploadImage" :on-success="handleDefaultImgUrl" :limit="3" :on-remove="hadleDefaultRemove" :on-exceed="scotlandThr" :file-list="fileDefaultList" list-type="picture" ref="sunsetstripz">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="轮播图" prop="carouseImg">
                    <el-upload class="upload-demo" multiple action="/sys/image/uploadImage" :on-success="handleCarouselImgUrl" :limit="5" :on-remove="hadleCarouselRemove" :on-exceed="scotlandFif" :file-list="fileCarouselList" list-type="picture" ref="sunsetstripl">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="editRobeItemDialogVisible = false">返回</el-button>
                <el-button type="primary" @click="editData()">保存</el-button>
            </span>
        </el-dialog>
        <!-- 风格列表 -->
        <el-dialog title="风格列表" :visible.sync="stylusDialogVisible" width="1000px" class="styleDlog">
            <div class="operarea">
                <div class="seach">
                    <el-input v-model="seachStyleForm.name" :placeholder="$t('name')" clearable size="mini" @keydown.enter.native="seachStyleData"></el-input>
                    <el-input v-model="seachStyleForm.description" :placeholder="$t('description')" clearable size="mini" @keydown.enter.native="seachStyleData"></el-input>
                    <el-button size="mini" icon="el-icon-search" @click="seachStyleData"></el-button>
                </div>
            </div>
            <el-card class="cardBox">
                <el-table style="width: 100%" :data="styleRobeTab" highlight-current-row @current-change="handleStyleChange">
                    <el-table-column prop="name" :label="$t('name')">
                    </el-table-column>
                    <el-table-column prop="description" :label="$t('description')">
                    </el-table-column>
                    <el-table-column :label="$t('image')">
                        <template v-slot="scope">
                            <el-image :src="scope.row.imgUrl" class="feelImg" :preview-src-list="getSrcList(scope.$index)"></el-image>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    small
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :pager-count="11"
                    :current-page.sync="seachStyleForm.pageNo"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="seachStyleForm.pageSize"
                    layout="sizes, prev, pager, next"
                    :total="total1">
                </el-pagination>
            </el-card>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="stylusDialogVisible = false">已选择</el-button>
            </span>
        </el-dialog>
        <!-- 场景列表 -->
        <el-dialog title="场景列表" :visible.sync="sceneDialogVisible" width="1000px" class="styleDlog">
            <div class="operarea">
                <div class="seach">
                    <el-input v-model="seachSceneForm.name" :placeholder="$t('name')" clearable size="mini" @keydown.enter.native="seachSceneData"></el-input>
                    <el-button size="mini" icon="el-icon-search" @click="seachSceneData"></el-button>
                </div>
                <div class="btnList">
                    <el-button size="mini" @click="showAddSceneData">{{$t('add')}}</el-button>
                </div>
            </div>
            <el-card class="cardBox">
                <el-table style="width: 100%" :data="sceneTab" highlight-current-row @current-change="handleSceneChange">
                    <el-table-column prop="name" :label="$t('name')">
                    </el-table-column>
                    <el-table-column :label="$t('image')">
                        <template v-slot="scope">
                            <el-image :src="scope.row.imgUrl" class="feelImg" :preview-src-list="getSceneSrcList(scope.$index)"></el-image>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    small
                    @size-change="handleSceneSizeChange"
                    @current-change="handleSceneCurrentChange"
                    :pager-count="11"
                    :current-page.sync="seachSceneForm.pageNo"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="seachSceneForm.pageSize"
                    layout="sizes, prev, pager, next"
                    :total="totalScene">
                </el-pagination>
            </el-card>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="sceneDialogVisible = false">已选择</el-button>
            </span>
        </el-dialog>
        <!-- 添加场景 -->
        <el-dialog :title="$t('add')" :visible.sync="addSceneDialogVisible" width="600px" class="addNFRobeDlog" :close-on-click-modal="false" @close="addSceneDlogClose(addSceneForm)">
            <el-form :model="addSceneForm" :ref="addSceneForm" :rules="addSceneRules" label-position="left" label-width="80px">
                <el-form-item label="名称" prop="name">
                    <el-input v-model="addSceneForm.name" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="相关图片" prop="imgUrl">
                    <el-upload class="upload-demo" action="/sys/image/uploadImage" :on-success="handleSceneImgUrl" :on-remove="hadleSceneRemove" :file-list="fileSceneList" list-type="picture" :limit="1" :on-exceed="sceneScotland" ref="sunsetstripk">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="addSceneDialogVisible = false">返回</el-button>
                <el-button type="primary" @click="addSceneData()">保存</el-button>
            </span>
        </el-dialog>
        <!-- 推荐商品列表 -->
        <el-dialog title="推荐商品列表" :visible.sync="recommendProDialogVisible" width="1200px" class="styleDlog" @close="recommendProClose">
            <div class="operarea">
                <div class="seach">
                    <el-input v-model="seachRecProForm.bh" :placeholder="$t('encoding')" clearable size="mini" @keyup.enter.native="seachRecProData"></el-input>
                    <el-input v-model="seachRecProForm.name" :placeholder="$t('name')" clearable size="mini" @keyup.enter.native="seachRecProData"></el-input>
                    <el-input v-model="seachRecProForm.color" :placeholder="$t('color')" clearable size="mini" @keyup.enter.native="seachRecProData"></el-input>
                    <el-button size="mini" icon="el-icon-search" @click="seachRecProData"></el-button>
                </div>
                <div class="btnList">
                    <el-button size="mini" @click="switchAddMode">{{$t('add')}}</el-button>
                </div>
            </div>
            <el-card class="cardBox">
                <el-table style="width: 100%" ref="recProTable" :data="recommendProTab" row-key="uuid" @selection-change="handleRecProSelectionChange" stripe v-adaptive="{bottomOffset: 85}" height="100">
                    <el-table-column type="selection" :reserve-selection="true">
                    </el-table-column>
                    <el-table-column prop="itemCode" min-width="131" :label="$t('stylenum')">
                    </el-table-column>
                    <el-table-column prop="title" min-width="131" :label="$t('title')">
                    </el-table-column>
                    <el-table-column prop="styleName" min-width="131" :label="$t('style')">
                    </el-table-column>
                    <el-table-column prop="year" min-width="131" :label="$t('yearofthelisted')">
                    </el-table-column>
                    <el-table-column prop="technology" min-width="131" :label="$t('designprocess')">
                    </el-table-column>
                    <el-table-column prop="publishStatus" min-width="131" label="上下架状态">
                        <template v-slot="scope">
                            <el-tag :type="scope.row.publishStatus === '上架' ? 'success' : 'danger'" :effect="scope.row.publishStatus === '上架' ? 'dark' : 'plain'" size="mini">
                                {{ scope.row.publishStatus }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="newStatus" min-width="131" :label="$t('newpro')">
                        <template v-slot="scope">
                            <el-tag :type="scope.row.newStatus === '新品' ? 'success' : 'danger'" :effect="scope.row.newStatus === '新品' ? 'dark' : 'plain'" size="mini">
                                {{ scope.row.newStatus }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="hotStatus" min-width="131" label="热卖">
                        <template v-slot="scope">
                            <el-tag :type="scope.row.hotStatus === '热卖' ? 'success' : 'danger'" :effect="scope.row.hotStatus === '热卖' ? 'dark' : 'plain'" size="mini">
                                {{ scope.row.hotStatus }}
                            </el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="price" min-width="131" :label="$t('price')">
                    </el-table-column>
                    <el-table-column prop="createTime" min-width="131" :label="$t('addtime')">
                    </el-table-column>
                </el-table>
                <el-pagination
                    small
                    @size-change="handleRecProSizeChange"
                    @current-change="handleRecProCurrentChange"
                    :current-page.sync="seachRecProForm.pageNo"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="seachRecProForm.pageSize"
                    layout="sizes, prev, pager, next"
                    :total="totalRecPro">
                </el-pagination>
            </el-card>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="lalaCheck">已选择</el-button>
            </span>
        </el-dialog>
        <!-- 编码列表 -->
        <el-dialog title="编码列表" :visible.sync="matlistDialogVisible" width="1200px" class="styleDlog" @close="matDafultClose">
            <div class="operarea">
                <div class="seach">
                    <el-input v-model="seachMatForm.bh" :placeholder="$t('encoding')" clearable size="mini" @keyup.enter.native="seachCodeData"></el-input>
                    <el-input v-model="seachMatForm.name" :placeholder="$t('name')" clearable size="mini" @keyup.enter.native="seachCodeData"></el-input>
                    <el-input v-model="seachMatForm.color" :placeholder="$t('color')" clearable size="mini" @keyup.enter.native="seachCodeData"></el-input>
                    <el-button size="mini" icon="el-icon-search" @click="seachCodeData"></el-button>
                </div>
                <div class="btnList">
                    <el-button size="mini" @click="switchAddMode">{{$t('add')}}</el-button>
                </div>
            </div>
            <el-card class="cardBox">
                <el-table style="width: 100%" ref="codeRuleTable" :data="codeRuleTab" row-key="uuid" @selection-change="handleMatSelectionChange" stripe v-adaptive="{bottomOffset: 85}" height="100">
                    <el-table-column type="selection" :reserve-selection="true">
                    </el-table-column>
                    <el-table-column prop="bh" min-width="130" :label="$t('encoding')">
                    </el-table-column>
                    <el-table-column prop="name" min-width="120" :label="$t('name')">
                    </el-table-column>
                    <el-table-column prop="color" min-width="120" :label="$t('color')">
                    </el-table-column>
                    <el-table-column prop="spec" min-width="120" :label="$t('parameter')">
                    </el-table-column>
                    <el-table-column prop="up" min-width="120" :label="$t('unitprice')">
                    </el-table-column>
                    <el-table-column prop="unit" min-width="120" :label="$t('unit')">
                    </el-table-column>
                    <el-table-column prop="createTime" min-width="140" :label="$t('time')">
                    </el-table-column>
                </el-table>
                <el-pagination
                    small
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page.sync="seachMatForm.pageNo"
                    :page-sizes="[10, 20, 30, 40]"
                    :page-size="seachMatForm.pageSize"
                    layout="sizes, prev, pager, next"
                    :total="total">
                </el-pagination>
            </el-card>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="jonyCheck">已选择</el-button>
            </span>
        </el-dialog>
        <!-- 成品编码 -->
        <el-dialog title="添加" :visible.sync="addItemDialogVisible" width="1000px" class="afterDlog" :close-on-click-modal="false" @close="addItemDlogClose()">
            <div class="dialogBox">
                <div class="addcode">
                    <div class="vibeItem">
                        <div class="row">
                            <div class="type-list" :ref="item.node" v-for="item in thirdColumn" :key="item.code" @click="getNextEncode(3, item.node, item.level, item.type)">{{item.label}}</div>
                        </div>
                        <div class="addImg" @click="addDataShow(3)">
                            <img src="@/assets/addBtn.png" alt="好像没网络了...">
                            <span>添加</span>
                        </div>
                    </div>
                    <div class="vibeItem" v-if="fourthFlag">
                        <div class="row">
                            <div class="type-list" :ref="item.node" v-for="item in fourthColumn" :key="item.code" @click="getNextEncode(4, item.node, item.level, item.type)">{{item.label}}</div>
                        </div>
                        <div class="addImg" @click="addDataShow(4)">
                            <img src="@/assets/addBtn.png" alt="好像没网络了...">
                            <span>添加</span>
                        </div>
                    </div>
                    <div class="vibeItem" v-if="fifFlag">
                        <div class="row">
                            <div class="type-list" :ref="item.node" v-for="item in fifColumn" :key="item.code" @click="getNextEncode(5, item.node, item.level, item.type)">{{item.label}}</div>
                        </div>
                        <div class="addImg" @click="addDataShow(5)">
                            <img src="@/assets/addBtn.png" alt="好像没网络了...">
                            <span>添加</span>
                        </div>
                    </div>
                </div>
                <div class="buttonOp">
                    <el-button class="createButton" type="primary" @click="createCode">生 成</el-button>
                </div>
                <div class="cut-off"></div>
                <template v-if="showParamFlag">
                    <div class="paramInput">
                        <div class="paramHead">
                            <div class="hdItem">{{$t('encoding')}}</div>
                            <div class="hdItem">{{$t('name')}}</div>
                            <div class="hdItem">{{$t('color')}}</div>
                            <div class="hdItem">{{$t('specification')}}</div>
                            <div class="hdItem">品牌</div>
                            <div class="hdItem">库存</div>
                            <div class="hdItem">{{$t('unitprice')}}</div>
                            <div class="hdItem">{{$t('unit')}}</div>
                        </div>
                        <div class="paramtd">
                            <div class="tdItem">{{addLiveType.bh}}</div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.name" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.color" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.spec" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.brand" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.stk" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.up" />
                            </div>
                            <div class="tdItem">
                                <el-input v-model="addLiveType.unit" readonly />
                            </div>
                        </div>
                    </div>
                    <div class="addition">
                        <div class="bz">
                            <div class="bzItem">备注</div>
                            <div class="bzItems">
                                <el-input v-model="addLiveType.remark" type="textarea" />
                            </div>
                        </div>
                        <div class="tp">
                            <div class="tpItem">{{$t('image')}}</div>
                            <div class="tpItems">
                                <el-upload class="upload-demo" action="/sys/image/uploadImage" :on-success="handleImg" :on-remove="hadleRemove" :limit="1" :on-exceed="scotland" ref="sunsetstrip">
                                    <el-button size="mini" type="primary">点击上传</el-button>
                                </el-upload>
                            </div>
                        </div>
                    </div>
                </template>
            </div>
            <div class="buttonOp" v-if="showParamFlag">
              <el-button type="primary" size="mini" @click="saveModeCode()">{{$t('save')}}</el-button>  
            </div>
        </el-dialog>
        <!-- 导出 -->
        <el-dialog :title="$t('export')" :visible.sync="exportDialogVisible" width="420px" class="smallDlog">
            <span>{{$t('whetoexptabdata')}}</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="exportDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="exportData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 上架 -->
        <el-dialog :title="$t('hint')" :visible.sync="putDialogVisible" width="420px" class="smallDlog" @close="putOrPullDlogClose()">
            <span>{{$t('wheputpro')}}</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="putDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="putData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 下架 -->
        <el-dialog :title="$t('hint')" :visible.sync="pullDialogVisible" width="420px" class="smallDlog" @close="putOrPullDlogClose()">
            <span>{{$t('wherempro')}}</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="pullDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="pullData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 新品 -->
        <el-dialog :title="$t('hint')" :visible.sync="newDialogVisible" width="420px" class="smallDlog" @close="newDlogClose()">
            <span>是否切换当前选中商品的新品状态？</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="newDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="newData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 热卖 -->
        <el-dialog :title="$t('hint')" :visible.sync="hotDialogVisible" width="420px" class="smallDlog" @close="hotDlogClose()">
            <span>是否切换当前选中商品的热卖状态？</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="hotDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="hotData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 删除 -->
        <el-dialog :title="$t('hint')" :visible.sync="delDialogVisible" width="420px" class="smallDlog" @close="delDlogClose()">
            <span>{{$t('confirmdel')}}</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delDialogVisible = false">{{$t('cancel')}}</el-button>
                <el-button type="primary" @click="delData">{{$t('confirm')}}</el-button>
            </span>
        </el-dialog>
        <!-- 添加根节点 -->
        <el-dialog :title="$t('add')" :visible.sync="addBaseDialogVisible" width="500px" class="smallDlog" :close-on-click-modal="false" @close="addBaseDlogClose(addBaseRootCode)">
            <el-form :model="addBaseRootCode" :rules="addBaseRules" :ref="addBaseRootCode" class="motuoForm">
                <el-form-item :label="$t('encoding')" label-width="70px" prop="code">
                    <el-input v-model="addBaseRootCode.code" clearable :placeholder="$t('plsent')"></el-input>
                </el-form-item>
                <el-form-item :label="$t('name')" label-width="70px" prop="name">
                    <el-input v-model="addBaseRootCode.name" clearable :placeholder="$t('plsent')"></el-input>
                </el-form-item>
                <el-form-item :label="$t('type')" label-width="70px" prop="type">
                    <el-input v-model="addBaseRootCode.type" clearable :placeholder="$t('plsent')"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="addBaseDialogVisible = false">{{$t("cancel")}}</el-button>
                <el-button type="primary" @click="addBaseMatEncode(addBaseRootCode)">{{$t("confirm")}}</el-button>
            </span>
        </el-dialog>
        <!-- 添加物料规则 -->
        <el-dialog :title="$t('add')" :visible.sync="addDialogVisible" width="500px" class="smallDlog" :close-on-click-modal="false" @close="addMatDlogClose(addRootCode)">
            <el-form :model="addRootCode" :rules="addRules" :ref="addRootCode" class="motuoForm">
                <el-form-item :label="$t('encoding')" label-width="70px" prop="code">
                    <el-input v-model="addRootCode.code" clearable :placeholder="$t('plsent')"></el-input>
                </el-form-item>
                <el-form-item :label="$t('name')" label-width="70px" prop="name">
                    <el-input v-model="addRootCode.name" clearable :placeholder="$t('plsent')"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="addDialogVisible = false">{{$t("cancel")}}</el-button>
                <el-button type="primary" @click="addMatEncode(addRootCode)">{{$t("confirm")}}</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import {
    getRobeItemList,
    getStyleAll,
    getMatCode,
    getMaxNumFromChild,
    updateParMatCode,
    insertMatDetail,
    addRobeItem,
    publishStatus,
    deleteStatus,
    hotStatus,
    newStatus,
    getClotheMatForProductAdd,
    addParMatCode,
    getItemDetails,
    updateItem,
    exportItem,
    getSceneList,
    addScene
} from '@/libs/reqlist.js'
export default {
    data () {
        var isletter = (rule, value, callback) => {
            var pattern = /^([A-Z]{1})?$/
            if (!pattern.test(value)) {
                return callback(new Error('请输入一位大写字母'))
            } else {
                callback()
            }
        }
        var isKong = (rule, value, callback) => {
            var pattern = value - 0
            if (pattern == 0) {
                return callback(new Error('编码不能全为0'))
            } else {
                callback()
            }
        }
        return {
            seachForm: {
                pageNo: 1,
                pageSize: 10,
                itemCode: '',
                type: 0,
                styleName: '',
                title: '',
                technology: '',
                deleteStatus: '',
                publishStatus: '',
                newStatus: '',
                hotStatus: ''
            },
            exportForm: {
                itemCode: '',
                type: 0,
                styleName: '',
                title: '',
                technology: '',
                deleteStatus: '',
                publishStatus: '',
                newStatus: '',
                hotStatus: ''
            },
            total: 0,
            bigRobeTab: [],
            selTabData: [],
            putOrPullDataForm: {
                publishStatus: 2,	
                ids: []
            },
            addDataForm: {
                type: 0,
                styleId: '',
                styleName: '',
                itemCode: '',
                title: '',
                year: '',
                keywords: '',
                imgUrl: '',
                carouselUrl: '',
                detailUrl: '',
                products: [],
                sceneId: '',
                sceneName: '',
                bindIds: []
            },
            addDataRules: {
                itemCode: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                styleName: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'change'}
                ],
                sceneName: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'change'}
                ],
                title: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                year: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                technology: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                bomCode: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                indexImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                defaultImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                carouseImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ]
            },
            // 轮播图暂存数组
            carouselUrlList: [],
            // 详情图暂存数组
            defaultUrlList: [],
            // 商品暂存数组
            proRobeList: [],
            addRobeItemDialogVisible: false,
            addDialogVisible: false,
            seachStyleForm: {
                type: 0,
                name: '',
                description: '',
                pageNo: 1,
                pageSize: 10
            },
            imgList: [],
            total1: 0,
            styleRobeTab: [],
            stylusDialogVisible: false,
            matlistDialogVisible: false,
            exportDialogVisible: false,
            putDialogVisible: false,
            pullDialogVisible: false,
            delDialogVisible: false,
            doType: 0,
            // 编码相关
            matEncode: {
                level: 3,
                type: 'clothe',
                parentNode: 'C01',
            },
            // 各子级是否显示
            secondFlag: false,
            thirdFlag: false,
            fourthFlag: false,
            fifFlag: false,
            // 各节点数据
            firstColumn: [],
            secondColumn: {},
            thirdColumn: [],
            fourthColumn: [],
            fifColumn: [],
            // 上一个被点击元素的ref值和level
            lastClickNode:'',
            lastClickLevel: '',
            addBaseDialogVisible: false,
            addBaseRootCode: {
                code: '',
                name: '',
                level: 1,
                type: '',
            },
            addBaseRules: {
                code: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" },
                    { validator: isletter, trigger: 'blur' }
                ],
                name: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" }
                ],
                type: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" }
                ]
            },
            addRootCode: {
                code: '',
                name: '',
                level: '',
                type: 'clothe',
            },
            addRules: {
                code: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" },
                    { validator: isKong, trigger: 'blur' }
                ],
                name: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" }
                ],
                type: [
                    { required: true, message: this.$t("cannotbeemp"), trigger: "blur" }
                ]
            },
            addItemDialogVisible: false,
            // 物料新增
            addLiveType: {
                name: '',
                bh: '',
                color: '',
                spec: '',
                brand: '',
                type: '',
                up: '',
                unit: 'pcs',
                pictureUrl: '',
                stk: ''
            },
            // 当前level下选中的值
            firstValue: '',
            secondValue: '',
            thirdValue: '',
            fourthValue: '',
            fifValue: '',
            // 各级选择节点parentNo记录
            secondParNode: '',
            thirdParNode: '',
            fourthParNode: '',
            fifthParNode: '',
            // 记录每层被点击node
            firClickNode: '',
            secClickNode: '',
            thrClickNode: '',
            fourClickNode: '',
            fifClickNode: '',
            // 编码相关参数框是否展示
            showParamFlag: false,
            seachMatForm: {
                bh: 'C01',
                name: '',
                color: '',
                pageNo: 1,
                pageSize: 10
            },
            codeRuleTab: [],
            delListData: {
                deleteStatus: 1,
                ids: []
            },
            newDataForm: {
                newStatus: 0,
                ids: []
            },
            newDialogVisible: false,
            isNew: 0,
            isNotNew: 0,
            hotDataForm: {
                hotStatus: 0,
                ids: []
            },
            hotDialogVisible: false,
            isHot: 0,
            isNotHot: 0,
            selMatTabData: [],
            // 编辑
            editRobeItemDialogVisible: false,
            fileIndexList: [],
            fileDefaultList: [],
            fileCarouselList: [],
            editDataForm: {
                type: '',
                id: '',
                styleId: '',
                styleName: '',
                itemCode: '',
                title: '',
                technology: '',
                year: '',
                stock: 0,
                keywords: '',
                imgUrl: '',
                carouselUrl: '',
                detailUrl: '',
                sceneId: '',
                sceneName: '',
                bindIds: []
            },
            editDataFormRules: {
                itemCode: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                styleName: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                sceneName: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                title: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                year: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                technology: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                bomCode: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                indexImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                defaultImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                carouseImg: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ]
            },
            proRobeIdList: [],
            // 场景相关
            sceneDialogVisible: false,
            seachSceneForm: {
                name: '',
                pageNo: 1,
                pageSize: 10
            },
            sceneImgList: [],
            sceneTab: [],
            totalScene: 0,
            addSceneDialogVisible: false,
            addSceneForm: {
                name: '',	
                imgUrl: ''
            },
            addSceneRules: {
                name: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'blur'}
                ],
                imgUrl: [
                    { required: true, message: this.$t('cannotbeemp'), trigger: 'change'}
                ]
            },
            fileSceneList: [],
            // 推荐商品
            proRecommendList: [],
            proRecommendIdList: [],
            recommendProDialogVisible: false,
            seachRecProForm: {
                pageNo: 1,
                pageSize: 10,
                itemCode: '',
                type: 0,
                styleName: '',
                title: '',
                technology: '',
                deleteStatus: '',
                publishStatus: '',
                newStatus: '',
                hotStatus: ''
            },
            recommendProTab: [],
            totalRecPro: 0,
            selectRecProTab: []
        }
    },
    methods: {
        seachData() {
            getRobeItemList(this.seachForm).then(res => {
                if (res.data.code == 0) {
                    res.data.data.data.forEach(item => {
                        switch (item.newStatus) {
                            case 0:
                                item.newStatus = '非新品'
                                break
                            case 1:
                                item.newStatus = '新品'
                                break
                        }
                        switch (item.hotStatus) {
                            case 0:
                                item.hotStatus = '非热卖'
                                break
                            case 1:
                                item.hotStatus = '热卖'
                                break
                        }
                        switch (item.publishStatus) {
                            case 0:
                                item.publishStatus = '待上架'
                                break
                            case 1:
                                item.publishStatus = '下架'
                                break
                            case 2:
                                item.publishStatus = '上架'
                                break
                        }
                    })
                    this.bigRobeTab = res.data.data.data
                    this.total = res.data.data.hits
                }
            })
        },
        getData() {
            this.seachForm.pageNo = 1
            this.seachData()
        },
        handleSizeChange (newSize) {
            this.seachForm.pageSize = newSize
            this.seachData()
        },
        handleCurrentChange(newNum) {
            this.seachForm.pageNo = newNum
            this.seachData()
        },
        handleSelectionChange (select) {
            this.selTabData = select
        },
        handleMatSelectionChange(select) {
            this.selMatTabData = select
        },
        checkStyle() {
            this.seachStyleData()
            this.stylusDialogVisible = true
        },
        seachStyleData() {
            getStyleAll(this.seachStyleForm).then(res => {
                if (res.data.code == 0) {
                    this.styleRobeTab = res.data.data.data
                    this.total1 = res.data.data.hits
                }
            })
        },
        getSrcList(index) {
            return this.imgList.slice(index).concat(this.imgList.slice(0, index))
        },
        handleStyleChange(row) {
            if (!row) return
            switch (this.doType) {
                case 0:
                    this.addDataForm.styleId = row.id
                    this.addDataForm.styleName = row.name
                    break
                case 1:
                    this.editDataForm.styleId = row.id
                    this.editDataForm.styleName = row.name
                    break
            }
        },
        scotland() {
            this.$message.warning('只能选择一张图片')
        },
        scotlandOne() {
            this.$message.warning('只能选择一张图片')
        },
        scotlandThr() {
            this.$message.warning('只能选择三张图片')
        },
        scotlandFif() {
            this.$message.warning('只能选择五张图片')
        },
        handleIndexImgUrl(res) {
            if (res.code == 0) {
                switch (this.doType) {
                    case 0:
                        this.addDataForm.imgUrl = res.data
                        break
                    case 1:
                        this.editDataForm.imgUrl = res.data
                        break
                }
            }
        },
        handleCarouselImgUrl(res) {
            if (res.code == 0) {
                switch (this.doType) {
                    case 0:
                        this.carouselUrlList.push(res.data)
                        break
                    case 1:
                        this.carouselUrlList.push(res.data)
                        break
                }
            }
        },
        handleDefaultImgUrl(res) {
            if (res.code == 0) {
                switch (this.doType) {
                    case 0:
                        this.defaultUrlList.push(res.data)
                        break
                    case 1:
                        this.defaultUrlList.push(res.data)
                        break
                }
            }
        },
        showAddDlog() {
            this.doType = 0
            this.addRobeItemDialogVisible = true
        },
        addData() {
            switch (this.carouselUrlList.length) {
                case 1:
                    this.addDataForm.carouselUrl = this.carouselUrlList[0]
                    break
                default:
                    this.addDataForm.carouselUrl = this.carouselUrlList.join(',')
            }
            switch (this.defaultUrlList.length) {
                case 1:
                    this.addDataForm.detailUrl = this.defaultUrlList[0]
                    break
                default:
                    this.addDataForm.detailUrl = this.defaultUrlList.join(',')
            }
            switch (this.proRecommendIdList.length) {
                case 0:
                    break
                default:
                    this.addDataForm.bindIds = this.proRecommendIdList
            }
            this.addDataForm.products = this.proRobeList
            if (this.addDataForm.styleId == '') return this.$message.warning('请先选择风格')
            if (this.addDataForm.styleName == '') return this.$message.warning('请先选择风格')
            if (this.addDataForm.itemCode == '') return this.$message.warning('款号不能为空')
            if (this.addDataForm.title == '') return this.$message.warning('标题不能为空')
            if (this.addDataForm.technology == '') return this.$message.warning('工艺不能为空')
            if (this.addDataForm.year == '') return this.$message.warning('年份不能为空')
            if (this.addDataForm.imgUrl == '') return this.$message.warning('主图不能为空')
            if (this.addDataForm.carouselUrl == '') return this.$message.warning('轮播图不能为空')
            if (this.addDataForm.detailUrl == '') return this.$message.warning('详情图不能为空')
            if (this.addDataForm.products == []) return this.$message.warning('请先选择商品')
            if (this.addDataForm.sceneId == '') return this.$message.warning('请选择场景')
            delete this.addDataForm.sceneName
            addRobeItem(JSON.stringify(this.addDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('添加成功')
                    this.addRobeItemDialogVisible = false
                    this.seachData()
                }
            })
        },
        addDlogClose(form) {
            this.addDataForm.styleId = ''
            this.addDataForm.styleName = ''
            this.addDataForm.itemCode = ''
            this.addDataForm.title = ''
            this.addDataForm.year = ''
            this.addDataForm.keywords = ''
            this.addDataForm.imgUrl = ''
            this.addDataForm.carouselUrl = ''
            this.addDataForm.detailUrl = ''
            this.addDataForm.technology = ''
            this.addDataForm.sceneId = ''
            this.addDataForm.sceneName = ''
            this.addDataForm.products = []
            this.carouselUrlList = []
            this.defaultUrlList = []
            this.proRobeIdList = []
            this.proRobeList = []
            this.fileIndexList = []
            this.fileDefaultList = []
            this.fileCarouselList = []
            this.proRecommendList = []
            this.proRecommendIdList = []
            this.addDataForm.bindIds = []
            this.$refs.sunsetstripk.clearFiles()
            this.$refs.sunsetstripl.clearFiles()
            this.$refs.sunsetstripz.clearFiles()
            this.$refs[form].resetFields()
        },
        addMatDlogClose(form) {
            this.$refs[form].resetFields();
        },
        showExport() {
            this.exportForm.itemCode = this.seachForm.itemCode
            this.exportForm.styleName = this.seachForm.styleName
            this.exportForm.title = this.seachForm.title
            this.exportForm.technology = this.seachForm.technology
            this.exportForm.deleteStatus = this.seachForm.deleteStatus
            this.exportForm.publishStatus = this.seachForm.publishStatus
            this.exportForm.newStatus = this.seachForm.newStatus
            this.exportForm.hotStatus = this.seachForm.hotStatus
            this.exportDialogVisible = true
        },
        exportData () {
            exportItem(this.exportForm).then(res => {
                if (res.status == 200) {
                    let date = new Date()
                    let name =  "大袍款式" + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + ".xls"
                    let blob = new Blob([res.data], {type: 'application/vnd.ms-excel;charset=utf-8'})
                    let url = window.URL.createObjectURL(blob);
                    let aLink = document.createElement("a");
                    aLink.style.display = 'none';
                    aLink.href = url;
                    aLink.setAttribute('download', name);
                    document.body.appendChild(aLink);
                    aLink.click();
                    document.body.removeChild(aLink); //下载完成移除元素
                    window.URL.revokeObjectURL(url); //释放掉blob对象
                    this.exportDialogVisible = false
                    this.$message.success('导出成功')
                }
            })
        },
        showPutOrPullData(type) {
            if (this.selTabData.length === 0) {
                this.$message.error(this.$t('plsselthepro'))
                return
            }
            switch (type) {
                case 1:
                    this.putOrPullDataForm.publishStatus = type
                    this.pullDialogVisible = true
                    break
                case 2:
                    this.putOrPullDataForm.publishStatus = type
                    this.putDialogVisible = true
            }
        },
        putData () {
            let isTure = this.selTabData.some(item => {
                this.putOrPullDataForm.ids.push(item.id)
                return item.publishStatus == '上架'
            })
            if (isTure) {
                this.putOrPullDataForm.ids = []
                this.putDialogVisible = false
                return this.$message.error('包含已上架款式，请重新选择')
            }
            publishStatus(JSON.stringify(this.putOrPullDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('上架成功')
                    this.putDialogVisible = false
                    this.seachData()
                    this.$refs.robeTable.clearSelection()
                }
            })

        },
        pullData () {
            let isTure = this.selTabData.some(item => {
                this.putOrPullDataForm.ids.push(item.id)
                return item.publishStatus == '下架'
            })
            if (isTure) {
                this.putOrPullDataForm.ids = []
                this.pullDialogVisible = false
                return this.$message.error('包含已下架款式，请重新选择')
            }
            publishStatus(JSON.stringify(this.putOrPullDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('下架成功')
                    this.pullDialogVisible = false
                    this.seachData()
                    this.$refs.robeTable.clearSelection()
                }
            })
        },
        putOrPullDlogClose() {
            this.putOrPullDataForm.ids = []
        },
        showHandleNew() {
            if (this.selTabData.length === 0) {
                this.$message.error(this.$t('plsselthepro'))
                return
            }
            this.selTabData.forEach(item => {
                this.newDataForm.ids.push(item.id)
                switch (item.newStatus) {
                    case '非新品':
                        this.isNotNew++
                        break
                    case '新品':
                        this.isNew++
                        break
                }
            })
            if (this.isNew > 0 && this.isNotNew > 0) {
                this.isNew = 0
                this.isNotNew = 0
                return this.$message.error('请选择同一状态商品进行操作')
            }
            if (this.isNew > 0) this.newDataForm.newStatus = 0
            if (this.isNotNew > 0) this.newDataForm.newStatus = 1
            this.newDialogVisible = true
        },
        newDlogClose() {
            this.isNew = 0
            this.isNotNew = 0
            this.newDataForm.ids = []
        },
        newData() {
            newStatus(JSON.stringify(this.newDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('操作成功')
                    this.newDialogVisible = false
                    this.seachData()
                    this.$refs.robeTable.clearSelection()
                }
            })
        },
        showHandleHot() {
            if (this.selTabData.length === 0) {
                this.$message.error(this.$t('plsselthepro'))
                return
            }
            this.selTabData.forEach(item => {
                this.hotDataForm.ids.push(item.id)
                switch (item.hotStatus) {
                    case '非热卖':
                        this.isNotHot++
                        break
                    case '热卖':
                        this.isHot++
                        break
                }
            })
            if (this.isHot > 0 && this.isNotHot > 0) {
                this.isHot = 0
                this.isNotHot = 0
                return this.$message.error('请选择同一状态商品进行操作')
            }
            if (this.isHot > 0) this.hotDataForm.hotStatus = 0
            if (this.isNotHot > 0) this.hotDataForm.hotStatus = 1
            this.hotDialogVisible = true
        },
        hotDlogClose() {
            this.isNotHot = 0
            this.isHot = 0
            this.hotDataForm.ids = []
        },
        hotData() {
            hotStatus(JSON.stringify(this.hotDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('操作成功')
                    this.hotDialogVisible = false
                    this.seachData()
                    this.$refs.robeTable.clearSelection()
                }
            })
        },
        showDelData () {
            if (this.selTabData.length === 0) {
                this.$message.error(this.$t('plsselthepro'))
                return
            }
            this.delDialogVisible = true
            this.selTabData.forEach(item => {
                this.delListData.ids.push(item.id)
            })
        },
        delData() {
            deleteStatus(JSON.stringify(this.delListData)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('删除成功')
                    this.delDialogVisible = false
                    this.seachData()
                    this.$refs.robeTable.clearSelection()
                }
            })
        },
        delDlogClose() {
            this.delListData.ids = []
        },
        getRecommend(id) {
            getItemDetails(id).then(res => {
                if (res.data.code == 0) {
                    this.doType = 1
                    this.editDataForm.type = res.data.data.type
                    this.editDataForm.id = res.data.data.id
                    this.editDataForm.styleId = res.data.data.styleId
                    this.editDataForm.styleName = res.data.data.styleName
                    this.editDataForm.sceneId = res.data.data.sceneId
                    this.editDataForm.sceneName = res.data.data.sceneName
                    this.editDataForm.itemCode = res.data.data.itemCode
                    this.editDataForm.title = res.data.data.title
                    this.editDataForm.technology = res.data.data.technology
                    this.editDataForm.year = res.data.data.year
                    this.editDataForm.stock = res.data.data.stock
                    this.editDataForm.keywords = res.data.data.keywords
                    this.editDataForm.imgUrl = res.data.data.imgUrl
                    this.editDataForm.carouselUrl = res.data.data.carouselUrl
                    this.editDataForm.detailUrl = res.data.data.detailUrl
                    if (this.editDataForm.imgUrl !== '' && this.editDataForm.imgUrl !== null) this.fileIndexList.push({ name: this.editDataForm.title, url: this.editDataForm.imgUrl })
                    if (this.editDataForm.detailUrl !== '' && this.editDataForm.detailUrl !== null) {
                        switch (this.editDataForm.detailUrl.indexOf(',')) {
                            case -1:
                                this.fileDefaultList.push({ name: res.data.data.title, url: this.editDataForm.detailUrl })
                                break
                            default:
                                res.data.data.detailUrl.split(',').forEach(item => {
                                    this.fileDefaultList.push({ name: res.data.data.title, url: item })
                                })
                        }
                    }
                    if (this.editDataForm.carouselUrl !== '' && this.editDataForm.carouselUrl !== null) {
                        switch (this.editDataForm.carouselUrl.indexOf(',')) {
                            case -1:
                                this.fileCarouselList.push({ name: res.data.data.title, url: this.editDataForm.carouselUrl })
                                break
                            default:
                                res.data.data.carouselUrl.split(',').forEach(item => {
                                    this.fileCarouselList.push({ name: res.data.data.title, url: item })
                                })
                        }
                    }
                    res.data.data.pmItemVOS.forEach(item => {
                        this.editDataForm.bindIds.push(item.id)
                        this.proRecommendIdList.push(item.id)
                        this.proRecommendList.push(item)
                    })
                    this.editRobeItemDialogVisible = true
                }
            })
        },
        editData() {
            switch (this.carouselUrlList.length) {
                case 1:
                    this.editDataForm.carouselUrl = this.carouselUrlList[0]
                    break
                case 0:
                    break
                default:
                    this.editDataForm.carouselUrl = this.carouselUrlList.join(',')
            }
            switch (this.defaultUrlList.length) {
                case 1:
                    this.editDataForm.detailUrl = this.defaultUrlList[0]
                    break
                case 0:
                    break
                default:
                    this.editDataForm.detailUrl = this.defaultUrlList.join(',')
            }
            switch (this.proRecommendIdList.length) {
                case 0:
                    break
                default:
                    this.editDataForm.bindIds = this.proRecommendIdList
            }
            delete this.editDataForm.sceneName
            if (this.editDataForm.styleId == '') return this.$message.warning('请先选择风格')
            if (this.editDataForm.styleName == '') return this.$message.warning('请先选择风格')
            if (this.editDataForm.itemCode == '') return this.$message.warning('款号不能为空')
            if (this.editDataForm.title == '') return this.$message.warning('标题不能为空')
            if (this.editDataForm.technology == '') return this.$message.warning('工艺不能为空')
            if (this.editDataForm.year == '') return this.$message.warning('年份不能为空')
            if (this.editDataForm.imgUrl == '') return this.$message.warning('主图不能为空')
            if (this.editDataForm.carouselUrl == '') return this.$message.warning('轮播图不能为空')
            if (this.editDataForm.detailUrl == '') return this.$message.warning('详情图不能为空')
            if (this.editDataForm.sceneId == '') return this.$message.warning('场景不能为空')
            updateItem(JSON.stringify(this.editDataForm)).then(res => {
                if (res.data.code == 0) {
                    this.$message.success('编辑成功')
                    this.editRobeItemDialogVisible = false
                    this.seachData()
                }
            })
        },
        editDlogClose(form) {
            this.fileIndexList = []
            this.fileDefaultList = []
            this.fileCarouselList = []
            this.defaultUrlList = []
            this.carouselUrlList = []
            this.proRecommendIdList = []
            this.proRecommendList = []
            this.editDataForm.type = ''
            this.editDataForm.id = ''
            this.editDataForm.styleId = ''
            this.editDataForm.styleName = ''
            this.editDataForm.itemCode = ''
            this.editDataForm.title = ''
            this.editDataForm.technology = ''
            this.editDataForm.year = ''
            this.editDataForm.stock = 0
            this.editDataForm.keywords = ''
            this.editDataForm.imgUrl = ''
            this.editDataForm.carouselUrl = ''
            this.editDataForm.detailUrl = ''
            this.editDataForm.sceneId = ''
            this.editDataForm.sceneName = ''
            this.editDataForm.bindIds = []
            this.$refs.sunsetstripk.clearFiles()
            this.$refs.sunsetstripz.clearFiles()
            this.$refs.sunsetstripl.clearFiles()
            this.$refs[form].resetFields()
        },
        hadleIndexRemove(file) {
            if (file) {
                switch (this.doType) {
                    case 0:
                        this.fileIndexList = []
                        this.addDataForm.imgUrl = ''
                        break
                    case 1:
                        this.fileIndexList = []
                        this.editDataForm.imgUrl = ''
                        break
                }
            }
        },
        hadleDefaultRemove(file, fileList) {
            if (file) {
                switch (this.doType) {
                    case 0:
                        this.defaultUrlList = []
                        fileList.forEach(item => {
                            this.defaultUrlList.push(item.response.data)
                        })
                        break
                    case 1:
                        this.defaultUrlList = []
                        fileList.forEach(item => {
                            this.defaultUrlList.push(item.url)
                        })
                        break
                }
            }
        },
        hadleCarouselRemove(file, fileList) {
            if (file) {
                switch (this.doType) {
                    case 0:
                        this.carouselUrlList = []
                        fileList.forEach(item => {
                            this.carouselUrlList.push(item.response.data)
                        })
                        break
                    case 1:
                        this.carouselUrlList = []
                        fileList.forEach(item => {
                            this.carouselUrlList.push(item.url)
                        })
                        break
                }
            }
        },
        seachCodeData() {
            if (this.seachMatForm.bh.length < 3) this.seachMatForm.bh = 'C01'
            if (this.seachMatForm.bh.length >= 3) {
                let isTrue = this.seachMatForm.bh.slice(0, 3)
                switch (isTrue) {
                    case 'C01':
                        break
                    default:
                        this.seachMatForm.bh = 'C01'
                        break
                }
            }
            this.getNewClotheMat()
        },
        // 编码相关
        switchAddMode() {
            this.getMatEnCode()
            this.addItemDialogVisible = true
        },
        addItemDlogClose() {
            this.matEncode.level = 3
            this.matEncode.type = 'clothe'
            this.matEncode.parentNode = 'C01'
            this.getMatEnCode()
            this.firstValue = ''
            this.showParamFlag = false
            this.addLiveType.name = ''
            this.addLiveType.bh = ''
            this.addLiveType.color = ''
            this.addLiveType.spec = ''
            this.addLiveType.brand = ''
            this.addLiveType.stk = ''
            this.addLiveType.type = ''
            this.addLiveType.up = ''
            this.addLiveType.unit = 'pcs'
            if (this.thrClickNode !== '') {
                this.$refs[this.thrClickNode][0].style.background = '#fff'
                this.$refs[this.thrClickNode][0].style['color'] = '#515775'
            }
            this.firClickNode = ''
            this.secClickNode = ''
            this.thrClickNode = ''
            this.fourClickNode = ''
            this.fifClickNode = ''
        },
        getMatEnCode() {
            getMatCode(JSON.stringify(this.matEncode)).then(res => {
                if (res.data.code == 0) {
                    switch (this.matEncode.level) {
                        case 1:
                            this.secondFlag = false;
                            this.thirdFlag = false;
                            this.fourthFlag = false;
                            this.fifFlag = false;
                            res.data.data.forEach(item => {
                                item.label = item.code + '-' + item.name
                            })
                            this.firstColumn = res.data.data;
                            break;
                        case 2:
                            this.secondFlag = true;
                            this.thirdFlag = false;
                            this.fourthFlag = false;
                            this.fifFlag = false;
                            res.data.data.forEach(item => {
                                item.label = item.code + '-' + item.name
                            })
                            this.secondColumn = res.data.data;
                            break;
                        case 3:
                            this.thirdFlag = true;
                            this.fourthFlag = false;
                            this.fifFlag = false;
                            res.data.data.forEach(item => {
                                item.label = item.code + '-' + item.name
                            })
                            this.thirdColumn = res.data.data;
                            break;
                        case 4:
                            this.fourthFlag = true;
                            this.fifFlag = false;
                            res.data.data.forEach(item => {
                                item.label = item.code + '-' + item.name
                            })
                            this.fourthColumn = res.data.data;
                            break;
                        case 5:
                            this.fifFlag = true
                            if (this.matEncode.type == 'wrapper') this.fifFlag = false;
                            res.data.data.forEach(item => {
                                item.label = item.code + '-' + item.name
                            })
                            this.fifColumn = res.data.data;
                            break;
                    }
                }
            })
        },
        getNextEncode(seleteType, node, level, type) {
            this.showParamFlag = false
            switch (seleteType) {
                case 1:
                    // this.keyValue = this.firstValue.split('-')[0]
                    // this.matEncode.parentNode = this.firstValue.split('-')[0]
                    // this.matEncode.level = parseInt(this.firstValue.split('-')[1]) + 1
                    // this.matEncode.type = this.firstValue.split('-')[2]
                    this.$refs[node][0].style.background = '#515775'
                    this.$refs[node][0].style['color'] = '#fff'
                    if (this.firClickNode !== node && this.firClickNode !== '') {
                        this.$refs[this.firClickNode][0].style.background = '#fff'
                        this.$refs[this.firClickNode][0].style['color'] = '#515775'
                    }
                    if (this.secClickNode !== node && this.secClickNode != '') {
                        this.$refs[this.secClickNode][0].style.background = '#fff'
                        this.$refs[this.secClickNode][0].style['color'] = '#515775'
                    }
                    this.thirdFlag = false;
                    this.fourthFlag = false;
                    this.fifFlag = false;
                    this.keyValue = node
                    this.matEncode.parentNode = node
                    this.matEncode.level = level + 1
                    this.matEncode.type = type
                    this.secondParNode = this.matEncode.parentNode
                    this.getMatEnCode()
                    this.isAddFlag = true
                    this.secondValue = ''
                    this.thirdValue = ''
                    this.fourthValue = ''
                    this.fifValue = ''
                    this.createLastNode = node
                    this.firClickNode = node
                    this.secClickNode = ''
                    this.thrClickNode = ''
                    this.fourClickNode = ''
                    this.fifClickNode = ''
                    // this.createLastNode = this.firstValue.split('-')[0]
                    break
                case 2:
                    // this.matEncode.parentNode = this.secondValue.split('-')[0]
                    // this.matEncode.level = parseInt(this.secondValue.split('-')[1]) + 1
                    // this.matEncode.type = this.secondValue.split('-')[2]
                    this.$refs[node][0].style.background = '#515775'
                    this.$refs[node][0].style['color'] = '#fff'
                    if (this.secClickNode !== node && this.secClickNode !== '') {
                        this.$refs[this.secClickNode][0].style.background = '#fff'
                        this.$refs[this.secClickNode][0].style['color'] = '#515775'
                    }
                    if (this.thrClickNode !== node && this.thrClickNode !== '') {
                        this.$refs[this.thrClickNode][0].style.background = '#fff'
                        this.$refs[this.thrClickNode][0].style['color'] = '#515775'
                    }
                    this.fourthFlag = false;
                    this.fifFlag = false;
                    this.matEncode.parentNode = node
                    this.matEncode.level = level + 1
                    this.matEncode.type = type
                    this.thirdParNode = this.matEncode.parentNode
                    this.getMatEnCode()
                    this.isAddFlag = true
                    this.thirdValue = ''
                    this.fourthValue = ''
                    this.createLastNode = node
                    this.secClickNode = node
                    this.thrClickNode = ''
                    this.fourClickNode = ''
                    this.fifClickNode = ''
                    // this.createLastNode = this.secondValue.split('-')[0]
                    this.fifValue = ''
                    break
                case 3:
                    // this.matEncode.parentNode = this.thirdValue.split('-')[0]
                    // this.matEncode.level = parseInt(this.thirdValue.split('-')[1]) + 1
                    // this.matEncode.type = this.thirdValue.split('-')[2]
                    this.$refs[node][0].style.background = '#515775'
                    this.$refs[node][0].style['color'] = '#fff'
                    if (this.thrClickNode !== '' && this.thrClickNode !== node) {
                        this.$refs[this.thrClickNode][0].style.background = '#fff'
                        this.$refs[this.thrClickNode][0].style['color'] = '#515775'
                    }
                    if (this.fourClickNode !== '' && this.fourClickNode !== node) {
                        this.$refs[this.fourClickNode][0].style.background = '#fff'
                        this.$refs[this.fourClickNode][0].style['color'] = '#515775'
                    }
                    this.fifFlag = false;
                    this.keyValue = node
                    this.matEncode.parentNode = node
                    this.matEncode.level = level + 1
                    this.matEncode.type = type
                    this.fourthParNode = this.matEncode.parentNode
                    this.getMatEnCode()
                    this.isAddFlag = true
                    this.fourthValue = ''
                    this.createLastNode = node
                    this.thrClickNode = node
                    this.fourClickNode = ''
                    this.fifClickNode = ''
                    // this.createLastNode = this.thirdValue.split('-')[0]
                    this.fifValue = ''
                    break
                case 4:
                    // this.matEncode.parentNode = this.fourthValue.split('-')[0]
                    // this.matEncode.level = parseInt(this.fourthValue.split('-')[1]) + 1
                    // this.matEncode.type = this.fourthValue.split('-')[2]
                    this.$refs[node][0].style.background = '#515775'
                    this.$refs[node][0].style['color'] = '#fff'
                    if (this.fourClickNode !== '' && this.fourClickNode !== node) {
                        this.$refs[this.fourClickNode][0].style.background = '#fff'
                        this.$refs[this.fourClickNode][0].style['color'] = '#515775'
                    }
                    if (this.fifClickNode !== '' && this.fifClickNode !== node) {
                        this.$refs[this.fifClickNode][0].style.background = '#fff'
                        this.$refs[this.fifClickNode][0].style['color'] = '#515775'
                    }
                    this.matEncode.parentNode = node
                    this.matEncode.level = level + 1
                    this.matEncode.type = type
                    this.fifthParNode = this.matEncode.parentNode
                    this.getMatEnCode()
                    this.isAddFlag = true
                    this.createLastNode = node
                    this.fourClickNode = node
                    this.fifClickNode = ''
                    // this.createLastNode = this.fourthValue.split('-')[0]
                    this.fifValue = ''
                    break
                case 5:
                    this.$refs[node][0].style.background = '#515775'
                    this.$refs[node][0].style['color'] = '#fff'
                    if (this.fifClickNode !== '' && this.fifClickNode !== node) {
                        this.$refs[this.fifClickNode][0].style.background = '#fff'
                        this.$refs[this.fifClickNode][0].style['color'] = '#515775'
                    }
                    this.createLastNode = node
                    this.fifClickNode = node
                    // this.createLastNode = this.fifValue.split('-')[0]
                    this.isAddFlag = false
                    break
            }
        },
        addDataShow(level) {
            switch (level) {
                case 1:
                    this.addRootCode.level = level;
                    this.addBaseDialogVisible = true
                    break;
                case 2:
                    this.addRootCode.level = level;
                    this.addRootCode.type = this.matEncode.type
                    this.addRootCode.parentNode = this.secondParNode
                    getMaxNumFromChild(JSON.stringify({ node: this.secondParNode })).then(res => {
                        if (res.data.code == 0) {
                            this.addRootCode.code = res.data.data
                        }
                    })
                    this.addDialogVisible=true
                    break;
                case 3:
                    this.addRootCode.level = level;
                    this.addRootCode.type = this.matEncode.type
                    this.addRootCode.parentNode = this.thirdParNode
                    getMaxNumFromChild(JSON.stringify({ node: this.thirdParNode })).then(res => {
                        if (res.data.code == 0) {
                            this.addRootCode.code = res.data.data
                        }
                    })
                    this.addDialogVisible=true
                    break;
                case 4:
                    this.addRootCode.level = level;
                    this.addRootCode.type = this.matEncode.type
                    this.addRootCode.parentNode = this.fourthParNode
                    getMaxNumFromChild(JSON.stringify({ node: this.fourthParNode })).then(res => {
                        if (res.data.code == 0) {
                            this.addRootCode.code = res.data.data
                        }
                    })
                    this.addDialogVisible=true
                    break;
                case 5:
                    this.addRootCode.level = level;
                    this.addRootCode.type = this.matEncode.type
                    this.addRootCode.parentNode = this.fifthParNode
                    getMaxNumFromChild(JSON.stringify({ node: this.fifthParNode })).then(res => {
                        if (res.data.code == 0) {
                            this.addRootCode.code = res.data.data
                        }
                    })
                    this.addDialogVisible=true
                    break;
            }
        },
        addBaseDlogClose(form) {
            this.$refs[form].resetFields();
        },
        addMatEncode(form) {
            this.$refs[form].validate((valid) => {
                if (!valid) return;
                addParMatCode(JSON.stringify(this.addRootCode)).then(res => {
                    if (res.data.code == 0) {
                        this.$message({
                            type: 'success',
                            message: this.$t('newmaterialcategoryadded')
                        })
                        this.addDialogVisible = false
                        this.matEncode.parentNode = this.addRootCode.parentNode
                        this.matEncode.level = this.addRootCode.level
                        this.getMatEnCode()
                    }
                })
            })
        },
        addBaseMatEncode(form) {
            this.$refs[form].validate((valid) => {
                if (!valid) return;
                addParMatCode(JSON.stringify(this.addBaseRootCode)).then(res => {
                    if (res.data.code == 0) {
                        this.$message({
                            type: 'success',
                            message: this.$t('newmaterialcategoryadded')
                        })
                        this.addBaseDialogVisible = false
                        this.matEncode.parentNode = this.addBaseRootCode.parentNode
                        this.matEncode.level = this.addBaseRootCode.level
                        this.getMatEnCode()
                    }
                })
            })
        },
        createCode() {
            updateParMatCode(JSON.stringify({ node: this.createLastNode })).then(res => {
                if (res.data.code == 0) {
                    this.$message({
                        type: 'success',
                        message: this.$t('creatingasuccessful')
                    })
                    this.showParamFlag = true
                    this.addLiveType.bh = res.data.data
                    this.addLiveType.type = this.matEncode.type
                    this.isAddFlag = true
                }
            })
        },
        saveModeCode() {
            insertMatDetail(JSON.stringify(this.addLiveType)).then(res => {
                if (res.data.code == 0) {
                    this.$message({
                        type: 'success',
                        message: this.$t('sucadd')
                    })
                    this.addMode = false
                    this.addItemDialogVisible = false
                    this.getNewClotheMat()
                }
            })
        },
        getNewClotheMat() {
            getClotheMatForProductAdd(JSON.stringify(this.seachMatForm)).then(res => {
                if (res.data.code == 0) {
                    this.total = res.data.data.hits
                    this.codeRuleTab = res.data.data.data
                }
            })
        },
        showMatListDlog() {
            this.getNewClotheMat()
            this.matlistDialogVisible = true
        },
        matDafultClose() {
            this.$refs.codeRuleTable.clearSelection()
        },
        jonyCheck() {
            this.proRobeIdList = []
            this.proRobeList = []
            this.selMatTabData.forEach(item => {
                item.bomCode = item.bh
                item.price = item.up
                item.pic = item.pictureUrl
                item.size = item.spec
                item.colour = item.color
                delete item.bh
                delete item.brand
                delete item.color
                delete item.createTime
                delete item.delete_status
                delete item.name
                delete item.pictureUrl
                delete item.uuid
                delete item.updateTime
                delete item.up
                delete item.unit
                delete item.type
                delete item.spec
                this.proRobeIdList.push(item.bomCode)
                this.proRobeList.push(item)
            })
            this.matlistDialogVisible = false
        },
        // 图片上传
        handleImg(res) {
            if (res.code == 0) {
                this.addLiveType.pictureUrl = res.data
            }
        },
        hadleRemove(file) {
            if (file) {
                this.addLiveType.pictureUrl = ''
            }
        },
        // 场景相关
        checkScene() {
            this.getSceneData()
            this.sceneDialogVisible = true
        },
        getSceneData() {
            this.sceneImgList = []
            getSceneList(JSON.stringify(this.seachSceneForm)).then(res => {
                if (res.data.code == 0) {
                    res.data.data.data.forEach(item => {
                        if (item.imgUrl !== null && item.imgUrl !== '') this.sceneImgList.push(item.imgUrl)
                    })
                    this.sceneTab = res.data.data.data
                    this.totalScene = res.data.data.hits
                }
            })
        },
        seachSceneData() {
            this.seachSceneForm.pageNo = 1
            this.getSceneData()
        },
        getSceneSrcList(index) {
            return this.sceneImgList.slice(index).concat(this.sceneImgList.slice(0, index))
        },
        handleSceneSizeChange (newSize) {
            this.seachSceneForm.pageSize = newSize
            this.getSceneData()
        },
        handleSceneCurrentChange (newNum) {
            this.seachSceneForm.pageNo = newNum
            this.getSceneData()
        },
        handleSceneChange(row) {
            if (!row) return
            switch (this.doType) {
                case 0:
                    this.addDataForm.sceneId = row.id
                    this.addDataForm.sceneName = row.name
                    break
                case 1:
                    this.editDataForm.sceneId = row.id
                    this.editDataForm.sceneName = row.name
                    break
            }
        },
        sceneScotland() {
            this.$message.warning('只能选择一个文件')
        },
        handleSceneImgUrl(res) {
            if (res.code == 0) {
                this.addSceneForm.imgUrl = res.data
            }
        },
        hadleSceneRemove(file) {
            if (file) {
                this.fileSceneList = []
                this.addSceneForm.imgUrl = ''
            }
        },
        showAddSceneData() {
            this.addSceneDialogVisible = true
        },
        addSceneData() {
            if (this.addSceneForm.name == '' || this.addSceneForm.name == null) return this.$message.warning('请填写场景名称')
            if (this.addSceneForm.imgUrl == '' || this.addSceneForm.imgUrl == null) return this.$message.warning('请上传场景相关图片')
            addScene(JSON.stringify(this.addSceneForm)).then(res => {
                if (res.data.code == 0) {
                    this.addSceneDialogVisible = false
                    this.$message.success('添加成功')
                    this.getSceneData()
                }
            })
        },
        addSceneDlogClose(form) {
            this.addSceneForm.name = ''
            this.addSceneForm.imgUrl = ''
            this.fileSceneList = []
            this.$refs[form].resetFields()
        },
        // 推荐商品
        showRobeStyleListDlog() {
            this.getRecProData()
            this.recommendProDialogVisible = true
        },
        recommendProClose() {
            this.$refs.recProTable.clearSelection()
        },
        getRecProData() {
            getRobeItemList(this.seachRecProForm).then(res => {
                if (res.data.code == 0) {
                    res.data.data.data.forEach(item => {
                        switch (item.newStatus) {
                            case 0:
                                item.newStatus = '非新品'
                                break
                            case 1:
                                item.newStatus = '新品'
                                break
                        }
                        switch (item.hotStatus) {
                            case 0:
                                item.hotStatus = '非热卖'
                                break
                            case 1:
                                item.hotStatus = '热卖'
                                break
                        }
                        switch (item.publishStatus) {
                            case 0:
                                item.publishStatus = '待上架'
                                break
                            case 1:
                                item.publishStatus = '下架'
                                break
                            case 2:
                                item.publishStatus = '上架'
                                break
                        }
                    })
                    this.recommendProTab = res.data.data.data
                    this.totalRecPro = res.data.data.hits
                }
            })
        },
        seachRecProData() {
            this.getRecProData()
        },
        handleRecProSelectionChange(select) {
            this.selectRecProTab = select
        },
        lalaCheck() {
            this.proRecommendList = []
            this.proRecommendIdList = []
            if (this.selectRecProTab.length > 2) return this.$message.warning('请选择两个或以下推荐商品')
            this.selectRecProTab.forEach(item => {
                this.proRecommendList.push(item)
                this.proRecommendIdList.push(item.id)
            })
            this.recommendProDialogVisible = false
        },
        handleRecProSizeChange (newSize) {
            this.seachRecProForm.pageSize = newSize
            this.getRecProData()
        },
        handleRecProCurrentChange (newNum) {
            this.seachRecProForm.pageNo = newNum
            this.getRecProData()
        }
    },
    mounted() {
        this.seachData()
    }
}
</script>

<style lang="less" scoped>
@import './kbigrobe.less';
</style>
